feat(assets-controller): add snaps migration FF#9534
Open
Kriys94 wants to merge 3 commits into
Open
Conversation
Kriys94
force-pushed
the
feat/wpn-1489-stage-gated-ingestion-migration-networks
branch
8 times, most recently
from
July 17, 2026 09:12
2f2753c to
355b70c
Compare
Kriys94
marked this pull request as ready for review
July 17, 2026 09:37
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Kriys94
force-pushed
the
feat/wpn-1489-stage-gated-ingestion-migration-networks
branch
from
July 20, 2026 08:25
355b70c to
44376e0
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Contributor
Author
|
Preview build PR MetaMask/metamask-extension#44601 |
Kriys94
force-pushed
the
feat/wpn-1489-stage-gated-ingestion-migration-networks
branch
from
July 20, 2026 14:40
44376e0 to
d7c747d
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The
AssetsControllerneeds to take over assets ingestion (balances, metadata,prices) for the non-EVM networks currently owned by their Snaps — Solana,
Stellar, and Tron — but this has to happen gradually and be reversible per
network. Previously the
AssetsController/AccountsApiDataSourcehad no notionof a per-network migration state: the Accounts API data source hardcoded an
eip155-only filter for the chains it surfaced as active, so there was no safeway to stage the rollout or roll it back without a code change.
This PR adds stage-gated ingestion driven by the
RemoteFeatureFlagController, so the migration for each network can be advancedand rolled back independently via LaunchDarkly:
snaps-assets-migrationutil module defines the per-network rolloutmodel: the
SnapsAssetsMigrationStageenum (Off→ReadAssetsControllerWithFallback→
ReadAssetsControllerWithoutFallback→ReadAssetsControllerOnly), theper-network flag keys (
networkAssetsSnapsMigrationSolana,networkAssetsSnapsMigrationStellar,networkAssetsSnapsMigrationTron), andhelpers to resolve and evaluate a stage from remote feature flag state
(
parseSnapsAssetsMigrationStage,isMigrationStageActive,getSnapsAssetsMigrationNamespace,getMigrationStages,shouldSupportChain).AssetsControllerresolves each network's stage fromRemoteFeatureFlagControllerstate (read via theRemoteFeatureFlagController:getStatemessenger action). Migration networksare ingested (Account Activity WebSocket + Accounts API) only from
ReadAssetsControllerWithFallbackonward and left to the Snap when the stageis
Off— which is also the fail-safe when the flag is missing or thecontroller is unavailable. Non-migration namespaces (e.g.
eip155) are nevergated.
AccountsApiDataSourcenow gates the networks it surfaces as activechains on the same per-network stage (replacing the hardcoded
eip155-onlyfilter). It also subscribes to
RemoteFeatureFlagController:stateChange(mirroring
core-backend'sAccountActivityService) so newly-enablednetworks are picked up — and disabled ones dropped — without waiting for the
periodic refresh. A selector reduces the flags to a primitive migration-stage
signature so the handler only fires when a stage actually changes.
References
Checklist
Note
Medium Risk
Changes which non-EVM chains are ingested and subscribed based on live feature flags; incorrect parsing or gating could hide or double-source assets during the Snap migration.
Overview
Adds stage-gated rollout for moving Solana, Stellar, and Tron from Snap-owned assets into
AssetsController, driven by per-network LaunchDarkly flags (networkAssetsSnapsMigrationSolana,Stellar,Tron).A new
snaps-assets-migrationhelper definesSnapsAssetsMigrationStage(OffthroughReadAssetsControllerOnly), parses flag payloads (including threshold-scoped{ name, value }shapes), andshouldSupportChainsoeip155chains stay always-on while migration namespaces only surface fromReadAssetsControllerWithFallbackonward; missing flags or unavailable controller state fail closed toOff.AccountsApiDataSourcereplaces the hardcodedeip155:-only active-chain filter withshouldSupportChain, reads flags viaRemoteFeatureFlagController:getState, and subscribes toRemoteFeatureFlagController:stateChange(selector on joined migration stages) to refresh active chains when stages change.AssetsControllerallows that event on its messenger; migration types are exported from the package.@metamask/remote-feature-flag-controlleris added as a direct dependency.Reviewed by Cursor Bugbot for commit 821143d. Bugbot is set up for automated code reviews on this repo. Configure here.